using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ContainerUI_SelectButtonManager : MyCanvasGrounp
{
    [SerializeField]
    private Color select_color;
    private ContainerUI_Manager manager;
    private EItem screenCondition;

    public EItem ScreenCondition
    {
        set
        {
            if (value != screenCondition)
            {
                buttons[screenCondition].color = Color.white;
                buttons[value].color = select_color;
                manager.Panel.screenCondition = value;
                manager.Panel.Refresh();
                screenCondition = value;
            }
        }
    }

    private readonly Dictionary<EItem, Image> buttons = new Dictionary<EItem, Image>();

    private void Start()
    {
        manager = GetComponentInParent<ContainerUI_Manager>();
        ContainerUI_SelectButton[] _buttons = GetComponentsInChildren<ContainerUI_SelectButton>();
        foreach (ContainerUI_SelectButton button in _buttons)
            buttons.Add(button.Eitem, button.GetComponent<Image>());
        ScreenCondition = EItem.AnyKind;
        immediate = true;
        Visible = true;
    }
}
